-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Property filter enum tokens #2739
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2739 +/- ##
=======================================
Coverage 96.21% 96.22%
=======================================
Files 761 761
Lines 21502 21556 +54
Branches 7354 7326 -28
=======================================
+ Hits 20688 20742 +54
+ Misses 806 761 -45
- Partials 8 53 +45 ☔ View full report in Codecov by Sentry. |
9e32565
to
ec57f06
Compare
ec57f06
to
af7c2bf
Compare
af7c2bf
to
128fbd4
Compare
128fbd4
to
9853c8a
Compare
9853c8a
to
085c7b9
Compare
f592e4f
to
d16f901
Compare
d16f901
to
3d8604c
Compare
3d8604c
to
680473e
Compare
9b9c3dd
to
a8f6987
Compare
0fbd924
to
10eff20
Compare
10eff20
to
f0b493a
Compare
ccd4dbb
to
f0a1159
Compare
dee0e7b
to
27195c3
Compare
src/button-dropdown/internal.tsx
Outdated
@@ -230,9 +230,7 @@ const InternalButtonDropdown = React.forwardRef( | |||
{text} | |||
</InternalButton> | |||
); | |||
trigger = showMainActionOnly ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is needed so that onKeyDown and onKeyUp handlers are attached that prevent Enter keypress propagation. Without that, the main action cannot be activated with Enter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The listeners are attached to the outer div instead of the button dropdown? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure, but I think that is because those should work for both the trigger and the dropdown: if the listeners are added to the button dropdown trigger alone, that might change the current behaviour. I can experiment with that but in a standalone PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fixing an existing bug? If so, can we add coverage for the fix? I'd be OK with having this in a separate PR (actually even better).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a separate PR: #2897
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also created a separate one for embedded multiselect fixes: #2896
27195c3
to
92ef6ba
Compare
92ef6ba
to
1107f2c
Compare
src/button-dropdown/internal.tsx
Outdated
@@ -230,9 +230,7 @@ const InternalButtonDropdown = React.forwardRef( | |||
{text} | |||
</InternalButton> | |||
); | |||
trigger = showMainActionOnly ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The listeners are attached to the outer div instead of the button dropdown? Why?
@@ -12636,7 +12636,7 @@ The \`operation\` property has two valid values: "and", "or", and controls the j | |||
The \`tokens\` property is an array of objects that will be displayed to the user beneath the filtering input. When \`enableTokenGroups=true\`, the | |||
\`tokenGroups\` property is used instead, which supports nested tokens. | |||
Each token has the following properties: | |||
* value [string]: The string value of the token to be used as a filter. | |||
* value [unknown]: The value of the token to be used as a filter. Can be null or string for default tokens, string[] for enum tokens, and anything for tokens with custom forms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check that this API change is OK (the doc text update suggests yes), and this will not cause issues to existing customers (do we want to run a dry run?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did make a dry-run for the type update in collection hooks. In this PR no type was updated, but will do a dry-run as well, just in case.
The value has been essentially unknown since introduction of custom forms. The current PR should have no impact to the existing customers but those making something with the query and wanting to adopt the feature would need to ensure the type is correctly handled at runtime.
}; | ||
}; | ||
|
||
test('formats tokens using custom and default formatters', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we mean by "custom and default formatters"? Are we indeed testing both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the enum tokens are formatted as value.join(', ')
. It is also possible to provide a custom format function. In the test page this is done for State and Tags properties, in one case to translate options and in another case to truncate long values, if more than 5 options are selected.
114af6e
to
dd8a730
Compare
Description
Adds first-class support for multi-choice (enum) tokens in property filter.
Rel: [Tz3OAr3i2ni1], [0aVwAjMOimcN]
Depends on:
How has this been tested?
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.